package com.test.shiro.service;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.apache.shiro.session.Session;

import java.time.LocalDateTime;

/**
 * @author lzy
 * @version v1.0
 * Create DateTime: 2019/9/22 11:40
 */
public class ShiroService {
    @RequiresRoles({"admin"})
    public void testService() {
        System.out.println("testMethod time" + LocalDateTime.now());

        Session session = SecurityUtils.getSubject().getSession();
        Object val = session.getAttribute("key");

        System.out.println("service session val:" + val);
    }
}
